package com.ruoyi.message.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.message.mapper.OrderInfoMapper;
import com.ruoyi.message.domain.OrderInfo;
import com.ruoyi.message.service.IOrderInfoService;

/**
 * 预约Service业务层处理
 * 
 * @author zsc
 * @date 2023-04-06
 */
@Service
public class OrderInfoServiceImpl implements IOrderInfoService {
    @Autowired
    private OrderInfoMapper orderInfoMapper;

    /**
     * 查询预约
     * 
     * @param id 预约主键
     * @return 预约
     */
    @Override
    public OrderInfo selectOrderInfoById(String id) {
        return orderInfoMapper.selectOrderInfoById(id);
    }

    /**
     * 查询预约列表
     * 
     * @param orderInfo 预约
     * @return 预约
     */
    @Override
    public List<OrderInfo> selectOrderInfoList(OrderInfo orderInfo) {
        return orderInfoMapper.selectOrderInfoList(orderInfo);
    }

    /**
     * 新增预约
     * 
     * @param orderInfo 预约
     * @return 结果
     */
    @Override
    public int insertOrderInfo(OrderInfo orderInfo) {
        orderInfo.setCreateTime(DateUtils.getNowDate());
        return orderInfoMapper.insertOrderInfo(orderInfo);
    }

    /**
     * 修改预约
     * 
     * @param orderInfo 预约
     * @return 结果
     */
    @Override
    public int updateOrderInfo(OrderInfo orderInfo) {
        return orderInfoMapper.updateOrderInfo(orderInfo);
    }

    /**
     * 批量删除预约
     * 
     * @param ids 需要删除的预约主键
     * @return 结果
     */
    @Override
    public int deleteOrderInfoByIds(String[] ids) {
        return orderInfoMapper.deleteOrderInfoByIds(ids);
    }

    /**
     * 删除预约信息
     * 
     * @param id 预约主键
     * @return 结果
     */
    @Override
    public int deleteOrderInfoById(String id) {
        return orderInfoMapper.deleteOrderInfoById(id);
    }

    @Override
    public List<OrderInfo> selectOrderByCoach(Long id) {
        return orderInfoMapper.selectOrderByCoach(id);
    }

    @Override
    public List<OrderInfo> selectOrderByCourse(Long id) {
        return orderInfoMapper.selectByCourse(id);
    }

    @Override
    public List<OrderInfo> selectOrderByCoachAndCourse(Long coachId, Long courseId) {
        return orderInfoMapper.selectByCoachAndCourse(coachId, courseId);
    }
}
